package seu.evaluation.metric;

import java.util.ArrayList;


/**
 * 
 * @author samantha
 * 实现可维护性的度量
 * 通过调用6个子属性的度量实现
 *
 */
public class MaintainabilityMetricContext {

	private MaintainabilityDiagram diagramInfo;
	private MaintainabilityMetricStrategy mstrategy[] =new MaintainabilityMetricStrategy[6];
	
	public MaintainabilityMetricContext(MaintainabilityDiagram umlDiagramInfo){
		this.diagramInfo=umlDiagramInfo;
		mstrategy[0]=new ComplexityCCN();
		mstrategy[1]=new ComplexityFFC();
		mstrategy[2]=new CouplingRFC();
		mstrategy[3]=new CouplingCBO();
		mstrategy[4]=new CohesionLCC();
		mstrategy[5]=new CohesionTCC();
	}
	
	public ArrayList<MetricResult> run(){
		ArrayList<MetricResult> resultList = new ArrayList<MetricResult>();
		for( MaintainabilityMetricStrategy singleMetric : mstrategy ){
			resultList.add(singleMetric.run(this.diagramInfo));
		}
		return resultList;
	}	

}
